Skip to content

Run PHP coding standards when dependencies change - #257

Merged
triple0t merged 1 commit into
trunkfrom
update/phpcs-workflow-trigger-paths
Jul 28, 2026
Merged

triple0t merged 1 commit into
trunkfrom
update/phpcs-workflow-trigger-paths

Conversation

@triple0t

@triple0t triple0t commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Changes proposed in this Pull Request:

The PHP coding standards job only runs when a **.php file changes. That leaves a gap: a pull request that changes the project's dependencies is never linted, even though dependencies are what supply the coding standards themselves.

This is not hypothetical. The recent WPCS 3.4.1 update (GHSA-3pwp-g2mj-5p3v) touched composer.lock only. It replaced the entire coding-standards ruleset and no lint job ran on it.

This adds composer.json and composer.lock to the filter.

No changelog entry: this touches repo CI config, not the github-actions, jsdoc or tracking-jsdoc packages.

Detailed test instructions:

This changes when the workflow fires, not what it does, so the check is behavioural:

  1. Confirm the workflow still parses — GitHub rejects invalid YAML, so a green Actions tab here is the first signal.
  2. On this PR the job should run: it edits .github/workflows/php-coding-standards.yml, which was already in the filter.
  3. To prove the new behaviour, push a commit here changing only composer.lock (a whitespace edit is enough) and confirm the job still triggers. Before this change it would not have.
  4. Confirm nothing else changed: the diff should be four added lines, two per trigger.

Additional details:

No change to what phpcs does or which rules apply — only to when the job is triggered. The cost is that dependency-only pull requests now run one extra short job.

An earlier version of this PR also added phpcs.xml.dist to the filter. That is pulled out and left for a separate discussion: changing the lint config can surface pre-existing violations across the whole tree, and that deserves its own decision rather than riding along here.

@triple0t triple0t added the dependencies Pull requests that update a dependency file label Jul 28, 2026
The phpcs job only ran when a **.php file changed, so a pull request
that changed the project's dependencies went unchecked.

The WPCS 3.4.1 update was exactly that: it changed composer.lock only,
swapped the whole coding-standards ruleset underneath, and no lint ran
on it.

Adds composer.json and composer.lock to the filter.

No changelog entry: this touches repo CI config, not the `github-actions`, `jsdoc` or `tracking-jsdoc` packages.
@triple0t
triple0t force-pushed the update/phpcs-workflow-trigger-paths branch from 7c39f16 to 89c12d7 Compare July 28, 2026 12:19
@triple0t triple0t changed the title Run PHP coding standards when the lint config or dependencies change Run PHP coding standards when dependencies change Jul 28, 2026
@triple0t
triple0t merged commit 2acbcd6 into trunk Jul 28, 2026
1 check passed
@triple0t
triple0t deleted the update/phpcs-workflow-trigger-paths branch July 28, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant